﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using EnvironmentalMonitor.Support.Business.Manage;
using EnvironmentalMonitor.Support.Business;
using EnvironmentalMonitor.Support.Module;
using EnvironmentalMonitor.Support.Resource;

namespace EnvironmentalMonitor.WebApplication.Manage.PostMenu
{
    /// <summary>
    /// 管理Json数据页面类
    /// </summary>
    public partial class ManageJson : EnvironmentalMonitor.WebApplication.Abstract.AbstractListJson
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            const string POST_ID = "post_id";

            string postGuid = this.ParameterString(POST_ID);

            EnvironmentalMonitor.Support.Module.Manage.Post post = new Support.Module.Manage.Post();
            post.Guid = postGuid;

            PostMenuBusiness business = new PostMenuBusiness();
            int total = 0;
            List<EnvironmentalMonitor.Support.Module.Manage.PostMenu> modules = new List<Support.Module.Manage.PostMenu>();

            if (!string.IsNullOrEmpty(post.Guid))
            {
                modules = business.QueryByPost(post, ref total);
            }

            this.ListJsonData = new Abstract.ListJsonData();
            this.ListJsonData.total = total;
            this.ListJsonData.rows = modules;
            string json = this.Json();

            this.Response.Write(json);
            this.Response.Flush();
            this.Response.End();

        }
    }
}